#include<stdio.h>
struct change{
  char student_number[6];
  char name[11];
  int grade;
};
int main()
{
  int n,i;
  float average=0;
  int sum=0;
  scanf("%d",&n);
  struct change s[n];
  for(i=0;i<n;i++){
    scanf("%s %s %d",s[i].student_number,s[i].name,&s[i].grade);
    sum=sum+s[i].grade;
  }
  average=sum*1.0/n;
  printf("%.2f\n",average);
  for(i=0;i<n;i++){
    if(average>s[i].grade){
      printf("%s %s\n",s[i].name,s[i].student_number);
  }
  }
}
